package cn.lili.util;

import cn.lili.common.utils.StringUtils;
import lombok.Builder;
import lombok.Data;

/**
 * AMQP消息模型
 *
 * @author liushuai(liushuai711 @ gmail.com)
 * @version v4.0
 * @Description:
 * @since 2023/2/14 10:46
 */
@Builder
@Data
public class AmqpMessage {


    /**
     * 交换机
     */
    private String exchange;

    /**
     * 转发规则
     */
    private String routingKey;

    /**
     * 消息模型
     */
    private Object message;


    public String getRoutingKey() {
        if (StringUtils.isEmpty(routingKey)) {
            return exchange + "_ROUTING";
        }
        return routingKey;
    }
}
